
<head>
	<script>
  
	function changedb(id){
		if(!id || id=="")return;
		$.post(contextUrl+'/opt/base/setting/findAllSetting.ajax',{dbconn_dbid:id},function(data){ 
		var $tableList = $("#setting_container").empty();
	 		$.each(data,function(i,v){
	 			 $tableList.append("<div>"+v.name+" <a href='javascript:;' onclick=\"javascript:showDetail('"+ v.dbid +"','"+ v.name +"');\">查看明细</a></div>");
	 		});
	 	
	 	},'json');
	}
	function showDetail(setting_dbid,text){
		var url = contextUrl+'/opt/base/setting/detailIndex.do?setting_dbid='+setting_dbid ;
		parent.f_addTab(setting_dbid,"设置 "+text+" 明细", url );
	
	}
	
	function addSetting(){
		var dbconn_dbid = $("#dbList").val();
		if(!dbconn_dbid || dbconn_dbid=="" ) return;
		var name = $("#newName").val();
		var url = contextUrl+'/opt/base/setting/addSetting.ajax?dbconn_dbid='+dbconn_dbid ;
		$.getJSON(url,{name:name},function(){
		 changedb(dbconn_dbid);
		});
	
	}
	$(function(){
		 getDbList("#dbList");
	
	});
	</script>
</head>
<body style="height:100%"> 
	<table width=99.8% border="1" heihgt="100%">
		<tr>
			<td width="180" valign="top">
					<div><select id="dbList" style="width:100%;" size="30"  onchange="changedb(this.value,false)"></select> </div>
				 
			</td>
			<td  valign="top">
			<div> <input type="text" id="newName" name="name" /> <input type="button" onclick="javascript:addSetting();" value="添加设置"/></div>
			 
			<div id="setting_container">
				无设置
			</div>
		 
			</td>
		</tr>
	</table> 
</body>